from pathlib import Path
path = Path('view/PlanWidget.cpp')
text = path.read_text(encoding='utf-8')
old = """        setAttribute(Qt::WA_StyledBackground, false);\r\n        if (!parentWidget()) {\r\n            setAttribute(Qt::WA_TranslucentBackground, true);\r\n            setAutoFillBackground(false);\r\n        }\r\n\r\n        setResizeable(true);\r\n        setOnlyMoveByTitlebar(true);\r\n\r\n        if (!m_defaultStyleSheet.isEmpty()) {\r\n            setStyleSheet(m_defaultStyleSheet);\r\n        } else {\r\n            applyDefaultStyle();\r\n        }\r\n        updateFrameAppearance();\r\n        logDebug(\"[PlanWidget] Compact mode disabled\");\r\n    }\r\n}\r\n"""
new = """        setAttribute(Qt::WA_StyledBackground, false);\r\n        if (!parentWidget()) {\r\n            setAttribute(Qt::WA_TranslucentBackground, true);\r\n            setAutoFillBackground(false);\r\n        }\r\n\r\n        setResizeable(true);\r\n        setOnlyMoveByTitlebar(true);\r\n\r\n        if (!m_defaultStyleSheet.isEmpty()) {\r\n            setStyleSheet(m_defaultStyleSheet);\r\n        } else {\r\n            applyDefaultStyle();\r\n        }\r\n        if (!parentWidget()) {\r\n            Qt::WindowFlags restoreFlags = Qt::Window | Qt::WindowStaysOnTopHint | Qt::FramelessWindowHint;\r\n            setWindowFlags(restoreFlags);\r\n            show();\r\n        }\r\n        updateFrameAppearance();\r\n        logDebug(\"[PlanWidget] Compact mode disabled\");\r\n    }\r\n}\r\n"""
if old not in text:
    raise SystemExit('pattern not found')
text = text.replace(old, new, 1)
path.write_text(text, encoding='utf-8')
